#include <stdio.h>
#include <cstring>
#include <vector>
#include <iostream>
using namespace std;
const int MAXN=30;
vector<int> G[MAXN];
vector<int> not_G[MAXN];
bool visited[MAXN];
bool res;
void DFS(int now, int pre) {
	int len=G[now].size();
	visited[now]=true;
	int nex;
	for (int i=0; i<len; ++i) {
		nex=G[now][i];
		if (nex==pre) continue;
		if (visited[nex]) {
			res=false;
		}
		if (!visited[nex]) DFS(nex, now);
	}
}
int n;
void myDFS() {
	memset(visited, 0, sizeof(visited));
	for (int i=0; i<n; ++i) {
		if (!visited[i]) DFS(i, -1);
	}
}
int main() {
	int T;
	cin>>T;
	int tmp;
	while (T--) {
		scanf("%d", &n);
		for (int i=0; i<MAXN; ++i) {
			G[i].clear();
			not_G[i].clear();
		}
		for (short i=0; i<n; ++i) {
			for (short j=i+1; j<n; ++j) {
				scanf("%d", &tmp);
				if (n<9) {
					if (tmp) {
						G[i].push_back(j);
						G[j].push_back(i);
					}
					else {
						not_G[i].push_back(j);
						not_G[j].push_back(i);
					}
				}
			}
		}
		if (n>=9) {
			printf("Bad Team!\n");
			continue;
		}
		res=true;
		myDFS();
		swap(G,not_G);
		myDFS();
		if (res) printf("Great Team!\n");
		else printf("Bad Team!\n");
	}
	return 0;
} 
